package com.yu.yupicture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yu.yupicture.api.aliyunApi.model.ImageEditRequest;
import com.yu.yupicture.api.aliyunApi.model.ImageEditResponse;
import com.yu.yupicture.model.domain.dto.picture.*;
import com.yu.yupicture.model.domain.entry.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yu.yupicture.model.domain.entry.User;
import com.yu.yupicture.model.domain.vo.PictureVO;

import java.util.List;

/**
* @author Li Shuokang
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-07-30 15:32:13
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     * @param user
     * @param input
     * @return
     */
    PictureVO uploadPicture(User user, PictureUploadRequest pictureUploadRequest, Object input);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);

    /**
     * 获取查询条件
     *
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 分页查询（管理端，）
     *
     * @param pictureQueryRequest
     * @return
     */
    Page<Picture> page(PictureQueryRequest pictureQueryRequest);

    /**
     * 分页查询（用户端）
     *
     * @param pictureQueryRequest
     * @return
     */
    Page<PictureVO> pageVo(PictureQueryRequest pictureQueryRequest, User user);

    /**
     * 将图片集合进行转vo
     *
     * @param pictureList
     * @return
     */
    List<PictureVO> getPictureVOList(List<Picture> pictureList);

    /**
     * 将单个图片进行转vo
     */
    PictureVO getPicVoByPicture(Picture picture);

    /**
     * 根据id查询 图片
     */
    Picture getPictureById(Long id);

    /**
     * 根据id查询 图片 -用户端
     */
    PictureVO getPictureVoById(Long id,User user);

    /**
     * 根据id删除图片 -管理员
     */
    boolean deleteById(Long id);

    /**
     * 更新图片 -管理员
     */
    boolean updatePicture(PictureUpdateRequest pictureUpdateRequest,User user);

    /**
     * 更新图片 -用户端
     */
    boolean UserupdatePcture(PictureEditRequest pictureEditRequest,User user);

    /**
     * 校验图片
     */

    void checkPicture(Picture picture);

    /**
     * 补充审核参数
     */
    void addReviewParams(Picture picture, User user);

    /**
     * 审核图片（管理员端）
     */
    boolean reviewPicture(PictureReviewRequest pictureReviewRequest,User user);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );

    /**
     * 删除图片释放对应空间资源
     */
    void  deletePicturePutSpace(Picture picture);

    /**
     * 以图搜图功能
     */
    List<PictureVO> searchPictureVoByImage(Long spaceId, String picColor, User user);

    /**
     * 批量编辑
     */
    boolean batchEdit(PictureEditByBatchRequest pictureEditByBatchRequest, User user);

    /**
     * ai扩图
     */

    ImageEditResponse aiExpand(CreatePictureOutPaintingTaskRequest request);
}
